use mime::{APPLICATION_OCTET_STREAM, Mime};

fn main() {
    let invalid_mime_type = "i n v a l i d";
    let default_mime = invalid_mime_type
        .parse::<Mime>()
        .unwrap_or(APPLICATION_OCTET_STREAM);

    println!("MIME for {:?} used default value {:?}", invalid_mime_type, default_mime);

    let valid_mime_type = "TEXT/PLAIN";
    let parsed_mime = valid_mime_type
        .parse::<Mime>()
        .unwrap_or(APPLICATION_OCTET_STREAM);

    println!("MIME for {:?} was parsed as {:?}", valid_mime_type, parsed_mime);
}
